]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
main: put noise texture below startup animation, not still frames
authorRay Strode <rstrode@redhat.com>
Thu, 21 Feb 2013 19:32:23 +0000 (14:32 -0500)
committerRay Strode <rstrode@redhat.com>
Sat, 2 Mar 2013 22:44:26 +0000 (17:44 -0500)
Right now we take a still frame of the desktop before showing the
start up animation.  This gives us an animation over what was
there before startup.

That's not actually desirable when restarting the shell.  We don't
want to animate over undecorated windows, we really want to animate
over the noise texture.

This commit drops the still frames in favor of the noise texture.

https://bugzilla.gnome.org/show_bug.cgi?id=694326

js/ui/background.js
js/ui/layout.js
js/ui/main.js

index 3268059052a0de676683de8c02d51c5f3ab997c2..5aaf07bbddd34f8e9b4da08555b14abaa5233782 100644 (file)
@@ -576,6 +576,25 @@ const StillFrame = new Lang.Class({
 });
 Signals.addSignalMethods(StillFrame.prototype);
 
+const SystemBackground = new Lang.Class({
+    Name: 'SystemBackground',
+
+    _init: function() {
+        this._cache = getBackgroundCache();
+        this.actor = new Meta.BackgroundActor();
+
+        this._cache.getImageContent({ style: GDesktopEnums.BackgroundStyle.WALLPAPER,
+                                      filename: global.datadir + '/theme/noise-texture.png',
+                                      effects: Meta.BackgroundEffects.NONE,
+                                      onFinished: Lang.bind(this, function(content) {
+                                          this.actor.content = content;
+                                          this.emit('loaded');
+                                      })
+                                    });
+    }
+});
+Signals.addSignalMethods(SystemBackground.prototype);
+
 const Animation = new Lang.Class({
     Name: 'Animation',
 
index 8fe1eb7d33372d01eaefa378996c31d5b7845e21..c341c2ba9aaa4b976e2a8095a90f35c930ff8bab 100644 (file)
@@ -1,6 +1,7 @@
 // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
 
 const Clutter = imports.gi.Clutter;
+const GLib = imports.gi.GLib;
 const GObject = imports.gi.GObject;
 const Lang = imports.lang;
 const Mainloop = imports.mainloop;
@@ -200,9 +201,6 @@ const LayoutManager = new Lang.Class({
         global.stage.remove_actor(global.top_window_group);
         this.uiGroup.add_actor(global.top_window_group);
 
-        this._consoleBackgroundGroup = new Meta.BackgroundGroup();
-        global.stage.insert_child_below(this._consoleBackgroundGroup, null);
-
         this._backgroundGroup = new Meta.BackgroundGroup();
         global.window_group.add_child(this._backgroundGroup);
         this._backgroundGroup.lower_bottom();
@@ -541,17 +539,6 @@ const LayoutManager = new Lang.Class({
         // so events don't get delivered to X11 windows (which are distorted by the animation)
         global.stage_input_mode = Shell.StageInputMode.FULLSCREEN;
 
-        // build new backgrounds
-        for (let i = 0; i < this.monitors.length; i++) {
-            let monitor = this.monitors[i];
-
-            let stillFrame = new Background.StillFrame(i);
-            this._consoleBackgroundGroup.add_child(stillFrame.actor);
-
-            stillFrame.actor.set_size(this.monitors[i].width, this.monitors[i].height);
-            stillFrame.actor.set_position(this.monitors[i].x, this.monitors[i].y);
-        }
-
         if (Main.sessionMode.isGreeter) {
             this.panelBox.translation_y = -this.panelBox.height;
         } else {
@@ -570,6 +557,35 @@ const LayoutManager = new Lang.Class({
                                          y / global.screen_height);
             this.uiGroup.scale_x = this.uiGroup.scale_y = 0;
         }
+
+        this._systemBackground = new Background.SystemBackground();
+        this._systemBackground.actor.hide();
+
+        global.stage.insert_child_below(this._systemBackground.actor, null);
+
+        let constraint = new Clutter.BindConstraint({ source: global.stage,
+                                                      coordinate: Clutter.BindCoordinate.ALL });
+        this._systemBackground.actor.add_constraint(constraint);
+
+        let signalId = this._systemBackground.connect('loaded',
+                                                      Lang.bind(this, function() {
+                                                          this._systemBackground.disconnect(signalId);
+                                                          this._systemBackground.actor.show();
+
+                                                          // We're mostly prepared for the startup animation
+                                                          // now, but since a lot is going on asynchronously
+                                                          // during startup, let's defer emission of the
+                                                          // startup-prepared signal until the event loop is
+                                                          // uncontended and idle. This helps to prevent us
+                                                          // from running the animation when the system is
+                                                          // bogged down
+                                                          GLib.idle_add(GLib.PRIORITY_LOW,
+                                                                        Lang.bind(this, function() {
+                                                                                      this.emit('startup-prepared');
+                                                                                      return false;
+                                                                                  }));
+
+                                                      }));
     },
 
     startupAnimation: function() {
@@ -607,8 +623,8 @@ const LayoutManager = new Lang.Class({
 
         global.stage_input_mode = Shell.StageInputMode.NORMAL;
 
-        this._consoleBackgroundGroup.destroy();
-        this._consoleBackgroundGroup = null;
+        this._systemBackground.actor.destroy();
+        this._systemBackground = null;
 
         this._startingUp = false;
 
index 3a3f674250d077334145d11dd7017903e9485079..57b5a7aeb9ef112507cc6a6da14e5952f9bf5416 100644 (file)
@@ -196,13 +196,10 @@ function startSession() {
     ExtensionDownloader.init();
     ExtensionSystem.init();
 
-    // Run the startup animation as soon as the mainloop is idle enough.
-    // This is necessary to have it smooth and without interruptions from
-    // completed IO tasks
-    GLib.idle_add(GLib.PRIORITY_LOW, function() {
-        layoutManager.startupAnimation();
-        return false;
-    });
+    layoutManager.connect('startup-prepared',
+                          Lang.bind(this, function() {
+                              layoutManager.startupAnimation();
+                          }));
 }
 
 let _workspaces = [];